{% extends 'base.html' %}

{% block title %}首页{% endblock %}
{% block head %}
    <link rel="stylesheet" href="{{ url_for('static',filename='css/index.css') }}">
{% endblock %}

{% block main %}
    <div class="question-list">
        <ul>
            {% for question in questions %}
                <li>
                    <div class="avatar-group">
                        <img src="{{ url_for('static', filename='images/logo2.png') }}" alt="作者头像" class="avatar">
                    </div>
                    <div class="question-group">
                        <p class="question-title"><a href="{{ url_for('detail', question_id=question.id) }}">{{ question.title }}</a></p>
                        <p class="question-content">{{ question.content }}</p>
                        <div class="question-info">
                            <span class="question-author">{{ question.author.username | default('匿名', true) }}</span>
                            {% if question.create_time %}<span class="question-time">{{ question.create_time  }}</span>{% endif %}
                        </div>
                    </div>
                </li>

{#                {% if question %}#}
{#                {% else %}#}
{#                    <li>暂无相关数据</li>#}
{#                {% endif %}#}
            {% endfor %}
        </ul>
    </div>
{% endblock %}